package com.fjwt.gz.mch.ctrl.fans;

import cn.hutool.json.JSONUtil;
import com.fjwt.gz.core.exception.BizException;
import com.fjwt.gz.core.model.ApiRes;
import com.fjwt.gz.db.dto.FansPayDTO;
import com.fjwt.gz.db.entity.FansPayEntity;
import com.fjwt.gz.mch.ctrl.CommonCtrl;
import com.fjwt.gz.service.impl.FansPayService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**卡券三方出资公众号openid表相关接口**/

@Slf4j
@RestController
@RequestMapping("/api/fansPay")
public class FansPayController extends CommonCtrl {
    @Autowired
    private FansPayService fansPayService;


    /**添加出资方公众号openid**/
    @PostMapping("/add")
    public ApiRes addFansPay(){
        Long fansId = getCurrentUser().getFansId();
        FansPayDTO dto = getObject(FansPayDTO.class);
        dto.setFansId(fansId);
        log.info("添加卡券三方出资的表的信息，请求地址：/api/fansPay/add，返回结果：{}，fanId：{}", JSONUtil.toJsonStr(dto), fansId);
        fansPayService.addFansPay(dto);
        return ApiRes.ok();
    }

}
